{extend name="layout/layout"}
{block name="content"}
<main class="user_page  ">
    <section class="">
        <div class="layui-main">
            <div class="user_con">
                <div class="user_headpage" data-load="active_header">
                  {include file="user_activity/header" menu="list" /}
                </div>
                <div class="right_main ">

                    <p class="ft24 mb10 ft-bold">活動列表</p>
                    <p class="ft14 gary_c9 mb20 ft-bold">你可以在這裡管理跟 ACCUPASS 帳號有關的所有設定。</p>
                    <div class="block_com" style="min-height: 60vh;">
                       <from class="layui-form">
  
                          <div class="ticket_ul2 ar_table">
                             <table class="layui-table tac al_table ft-bold" lay-skin="nob">
                                <colgroup>
  
                                   <col width="130">
                                   <col width="">
                                   <col width="220">
                                   <col width="230">
                                   <col width="230">
                                </colgroup>
                                <thead>
                                   <tr>
                                      <th>
                                         <div class="">草稿</div>
                                      </th>
                                      <th>
                                         <div class="tac">審核中 ({$is_verify|default=0})</div>
                                      </th>
                                      <th>
                                         <div class="tac">已發佈 ({$publishs|default=0})</div>
                                      </th>
                                      <th>
                                         <div class="tac">下架 ({$offstate|default=0})</div>
                                      </th>
                                      <th>
                                         <div class="tac">全部 ({$all|default=0})</div>
                                      </th>
                                   </tr>
                                </thead>
                                <tbody>
                                 {if count($acts)} 
                                 {foreach $acts as $act}
                                 <tr>
                                    <td>
                                       <div class="text-align-left">

                                          <p class="ft13">{$act.name}</p>
                                          <p class="ft12 gary_c9">{$act.creator_name}</p>
                                       </div>
                                    </td>
                                    <td>
                                       <div class="text-align-center">

                                          <p class="ft13">{$act.state}</p>
                                          <!-- <p class="ft12 gary_c9">无须结算</p> -->
                                       </div>
                                    </td>
                                    <td class="ut_table">
                                       <div class="text-align-center">
                                          <div style="{$act.sale_status == 1 ? 'background-color:#F9AD28' : 'background-color:#eee'}">
                                             {if $act.sale_status == 2} 
                                             已结束 
                                             {elseif $act.sale_status ==3 /}
                                             已售完
                                             {elseif $act.sale_status ==4 /}
                                             未开售
                                             {else /} 
                                             售卖中 
                                             {/if}
                                          </div>
                                       
                                       </div>
                                    </td>
                                    <td>
                                       <div class="text-align-center">
                                          {$act.begin_time} - {$act.end_time}
                                       </div>
                                       
                                    </td>
                                    
                                    <td class="a_b1">
                                       <a href="/activity/user/activity/{$act.id}/allview.html">活动详情</a><a data-id="{$act.id}" class="offsale" >删除</a>
                                    </td>
                                     <!-- <td>{$act.begin_time} - {$act.end_time}</td>
                                     <td>{$act.create_time}</td>
                                     <td>{$act.creator_name}</td> -->
                                 </tr>
                              {/foreach}
                                 {/if}
                                
                                   
                                  
                                </tbody>
                             </table>
                          </div>
  
                       </from>
                    </div>
                 </div>
                <!-- <div class="right_main ">
                    <p class="ft24 mb10 ft-bold">活動列表</p>
                    <div class="block_com" style="min-height: 60vh;">
                        <from class="layui-form">

                            <div class="ticket_ul2 ar_table">
                                <table class="layui-table tac al_table ft-bold" lay-skin="nob">
                                    <thead>
                                    <tr>
                                        <th>
                                            <div class="">活动名称</div>
                                        </th>
                                        <th>
                                            <div class="tac">活动时间</div>
                                        </th>
                                        <th>
                                            <div class="tac">创建时间</div>
                                        </th>
                                        <th>
                                            <div class="tac">创建者</div>
                                        </th>
                                        <th></th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    {foreach $acts as $act}
                                    <tr>
                                        <td>{$act.name}</td>
                                        <td>{$act.begin_time} - {$act.end_time}</td>
                                        <td>{$act.create_time}</td>
                                        <td>{$act.creator_name}</td>
                                        <td class="a_b1">
                                            <a href="/activity/user/activity/{$act.id}/overview.html">详情</a>
                                        </td>
                                    </tr>
                                    {/foreach}
                                    </tbody>
                                </table>
                            </div>

                        </from>
                    </div>
                </div>  -->
               
            </div>
        </div>
    </section>
</main>
<script>
   $(document).on('click', '[data-btn="select"]', function () {
      var disabled = $(this).attr('data-status')
      if (disabled == 'disabled') {
         return;
      }
      $(this).toggleClass('icon-selected')
   })
   $(document).on('click', '.offsale', function () {
      var id = $(this).data('id') ?? 0
      if(id > 0){
         layer.confirm('确定下架吗?',{title:false}, function(index){
         $.quickPost('/activity/user/activity/offsale',{id:id}).done((res) => {
               location.reload();
         })
         layer.close(index);
         });
      }
     
   })
</script>
{/block}